https://leetcode.cn/problems/kth-smallest-element-in-a-bst/
class Solution {
public:
    int ret,i;

    void dfs(TreeNode *root)
    {
        if(root==nullptr||i==0)
            return ;
        dfs(root->left);
        --i;
        if(!i)
            ret=root->val;
        dfs(root->right);
    }
    int kthSmallest(TreeNode* root, int k) {
        ret=0,i=k;
        dfs(root);
        return ret;
    }
};